import 'package:flutter/material.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';

import 'package:test_app/core/utils/common/common_util.dart';
import 'package:test_app/core/design_system/theme/color.dart';
import 'package:test_app/core/design_system/extensions/extensions.dart';

// 文字剪切板
class Clipboard extends StatelessWidget {
  final String code;

  const Clipboard({super.key, required this.code});


  @override
  Widget build(BuildContext context) {
    return [
      [
        Text('code').textColor(Color(0xFFBDBDBD)),
        Icon(TDIcons.file_copy).iconSize(15).iconColor(Color(0xFFBDBDBD)).animatedTapScale(() {
          CommonUtil.copy(code);
        }, color: Color(0xFFBDBDBD) )
      ].toRowBetween(),
      Text(code)
    ].toColumnStart(spacing: 8).padAll(10).backgroundColor(primaryLight).border(all: 1, radius: 6, color: primaryDark);
  }

}